<template>
  <div ref="mapDiv"></div>
</template>

<script setup lang="ts">
// @ts-nocheck
import type { Response } from 'open-data-v/base'
import type TianMapComponent from '../config'
import type { BaiduMap } from '../type'
import { useEchart } from '../../../hooks'
import { onMounted, ref } from 'vue'

const mapDiv = ref<HTMLElement>()
var map = null
const initMap = () => {
  // 初始化地图
  var BMap = window.BMap
  // 创建Map实例
  map = new BMap.Map(mapDiv.value)
  // 设置显示地图的中心点和级别
  // 116.40969, 39.89945
  map.centerAndZoom(new BMap.Point(114.5120205423622, 38.04291764925318), 11);
  map.addControl(
    new BMap.MapTypeControl({
      mapTypes: [BMAP_NORMAL_MAP, BMAP_HYBRID_MAP]
    })
  )
  map.setCurrentCity("北京");          // 设置地图显示的城市 此项是必须设置的
	map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放
}
const { resizeHandler } = useEchart(mapDiv)
onMounted(() => {
  initMap()
})
</script>
